from django.core.management.base import BaseCommand#, CommandError
from django.core.cache import cache

from ...utils.manager import CACHE_NAME


def get_cache(): return cache.get(CACHE_NAME) or {}



class Command(BaseCommand):
    args = '<poll_id poll_id ...>'
    help = 'Does all cronjobs' #@ReservedAssignment

    def handle(self, *args, **options):
        cache_= get_cache()

        for key, manager in cache_.items():
            print "%s:" % key 
            print "    resource:  %s" % manager.resource
            print "    size:      %s" % str(getattr(manager, 'size', None))
            print "    hash:      %s" % manager.hash
            print "    extension: %s" % manager.extension
            print ""
